<span page-title>{{ 'Content Credentials' | translate }}</span>

<div data-extend-template="layouts/table-with-header.html">
  <div data-block="header">
    <h2 translate>Content Credentials</h2>
  </div>

  <div data-block="list-actions">
    <button type="button" class="btn btn-primary" ui-sref="content-credentials.new" ng-hide="denied('create_content_credentials')">
      <span translate>Create Content Credential</span>
    </button>
  </div>

  <span data-block="no-rows-message" translate>
    You currently don't have any Content Credential, you can add Content Credentials using the button on the right.
  </span>

  <span data-block="no-search-results-message" translate>
    Your search returned zero Content Credential.
  </span>

  <div data-block="table">
    <table bst-table="table" class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">
      <thead>
      <tr bst-table-head>
        <th bst-table-column="name" sortable><span translate>Name</span></th>
        <th bst-table-column="organization"><span translate>Organization</span></th>
        <th bst-table-column="content_type"><span translate>Type</span></th>
        <th bst-table-column="products" class="number-cell"><span translate>Product Count</span></th>
        <th bst-table-column class="number-cell"><span translate>Repository Count</span></th>
      </tr>
      </thead>

      <tbody>
      <tr bst-table-row ng-repeat="contentCredential in table.rows">
        <td bst-table-cell>
          <a ui-sref="content-credential.info({contentCredentialId: contentCredential.id})">{{ contentCredential.name }}</a>
        </td>
        <td bst-table-cell>{{ contentCredential.organization.name }}</td>
        <td bst-table-cell>{{ contentCredential.content_type | contentTypeFilter }}</td>
        <td bst-table-cell class="number-cell">{{ contentCredential.gpg_key_products.length +
            contentCredential.ssl_ca_products.length +
            contentCredential.ssl_client_products.length +
            contentCredential.ssl_key_products.length || 0 }}</td>
        <td bst-table-cell class="number-cell">{{ contentCredential.gpg_key_repos.length +
            contentCredential.ssl_ca_root_repos.length +
            contentCredential.ssl_client_root_repos.length +
            contentCredential.ssl_key_root_repos.length || 0 }}
        </td>
      </tr>
      </tbody>
    </table>

  </div>
</div>
